<template>
  <div class="boxList">
    <div
      v-for="(item, index) in boxes"
      :key="index"
      class="item"
      :class="item.status"
      @click="goToDay(index)"
    >
      <NuxtImg :src="item.img" />
      <p>{{ lang.day }} {{ item.day }}</p>
    </div>
  </div>
</template>

<script setup lang="ts">
const props = defineProps<{
  baseData: any;
}>();

const lang: any = getCurrentPageLang("activity/tesouro");

type BoxStatus = "" | "Expired" | "current";
interface BoxItem {
  day: number;
  img: string;
  status: BoxStatus;
}

const boxes: BoxItem[] = [
  {
    day: 2,
    img: "/images/activity/tesouro/MysteriousBoxClose0.png",
    status: "Expired",
  },
  {
    day: 3,
    img: "/images/activity/tesouro/MysteriousBoxClose1.png",
    status: "current",
  },
  {
    day: 4,
    img: "/images/activity/tesouro/MysteriousBoxClose2.png",
    status: "",
  },
  {
    day: 5,
    img: "/images/activity/tesouro/MysteriousBoxClose3.png",
    status: "",
  },
  {
    day: 6,
    img: "/images/activity/tesouro/MysteriousBoxClose4.png",
    status: "",
  },
  {
    day: 7,
    img: "/images/activity/tesouro/MysteriousBoxClose5.png",
    status: "",
  },
];

function goToDay(index: number) {
  props.baseData.swiperRef.goTo(index);
}
</script>

<style scoped lang="scss">
.boxList {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}
.boxList .item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  width: 1.5rem;
  height: 1.8rem;
  color: var(--theme-neutral1);
  border-radius: 0.2rem;
  position: relative;
  border: 0.03rem solid var(--theme-color7);
}
.boxList .Expired {
  position: relative;
}
.boxList .item.current {
  border-color: var(--theme-color1);
  box-shadow: 0 0 0.1rem rgba(0, 0, 0, 0.08);
  background: linear-gradient(
    180deg,
    var(--theme-ts1-gradient1) 0%,
    var(--theme-ts1-gradient2) 100%
  );
  border: none;
  p {
    background-color: transparent;
  }
}
.boxList .item img {
  width: 1.1rem;
  height: 1.1rem;
}
.boxList .item p {
  width: 1.5rem;
  height: 0.54rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--theme-color1);
  border-radius: 0 0 0.2rem 0.2rem;
  position: absolute;
  bottom: -0.025rem;
}
.boxList .Expired p {
  position: relative;
  z-index: 1;
}
.boxList .Expired:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #00000080;
  border-radius: 0.2rem;
}
</style>
